<?php
class Article extends AppModel {

	var $name = 'Article';
	var $validate = array(
		'id' => array('numeric'),
		'user_id' => array('numeric'),
		'category_id' => array('numeric'),
		'rank_id' => array('numeric'),
//		'page_name' => array('alphanumeric'),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
			'User' => array('className' => 'User',
								'foreignKey' => 'user_id',
								'conditions' => '',
								'fields' => 'id,username',
								'order' => ''
			),
			'Category' => array('className' => 'Category',
								'foreignKey' => 'category_id',
								'conditions' => '',
								'fields' => 'id,name',
								'order' => ''
			),
			'Rank' => array('className' => 'Rank',
								'foreignKey' => 'rank_id',
								'conditions' => '',
								'fields' => 'id,name',
								'order' => ''
			)
	);

	var $hasMany = array(
			'Comment' => array('className' => 'Comment',
								'foreignKey' => 'article_id',
								'dependent' => false,
								'conditions' => '',
								'fields' => 'id,user_id,body',
								'order' => '',
								'limit' => '',
								'offset' => '',
								'exclusive' => '',
								'finderQuery' => '',
								'counterQuery' => ''
			),
			'Mml' => array('className' => 'Mml',
								'foreignKey' => 'article_id',
								'dependent' => false,
								'conditions' => '',
								'fields' => 'id,name,user_id,instrument_id,rank_id,pan,ch1,ch2,ch3',
								'order' => '',
								'limit' => '5',
								'offset' => '',
								'exclusive' => '',
								'finderQuery' => '',
								'counterQuery' => ''
			)
	);

	var $hasAndBelongsToMany = array(
			'Tag' => array('className' => 'Tag',
						'joinTable' => 'articles_tags',
						'foreignKey' => 'article_id',
						'associationForeignKey' => 'tag_id',
						'unique' => true,
						'conditions' => '',
						'fields' => '',
						'order' => '',
						'limit' => '5',
						'offset' => '',
						'finderQuery' => '',
						'deleteQuery' => '',
						'insertQuery' => ''
			)
	);

}
?>